# -*- coding: utf-8 -*-
from sqlalchemy import Column,String,Integer,Text,Binary,Boolean,DateTime,Enum,Float,BigInteger
from adminApp.extensions import db
from .base import BaseModel
import uuid


def gen_id():
    return uuid.uuid4().hex


class PveVmConf(BaseModel, db.Model):
    '''PVE 虚拟机配置文件'''
    virtual_machine_id = Column(Integer)
    name = Column(String(1024))
    status = Column(String(512))
    pid = Column(Integer)
    bookdisk = Column(Float)

    sockets = Column(Integer)
    cores = Column(Integer)
    cpu = Column(String(512))
    hostpci0 = Column(String(512))
    machine = Column(String(512))
    memory = Column(Integer)
    numa = Column(Integer)
    onboot = Column(Integer)
    ostype = Column(Integer)
    scsihw = Column(String(512))

    scsi_data_sum = Column(Integer)
    max_scsi_num = Column(Integer)
    smbios_uuid = Column(String(512))
    smbios_serial = Column(String(512))
    scsi0_serial = Column(String(512))
    template = Column(Integer)

    config = Column(Text)


    machine_id = db.Column(db.Integer, db.ForeignKey('machine.id', ondelete='CASCADE'), nullable=False, index=True)
    _machine = db.relationship('Machine', back_populates='pvevmconfes')